import { ServiceProto } from 'tsrpc-proto';
import { ReqLogin, ResLogin } from '../protocols/user/PtlLogin';
import { ReqJoinRoom, ResJoinRoom } from '../protocols/game/PtlJoinRoom';
import { MsgGameState } from '../protocols/game/MsgGameState';
import { MsgPlayerMove } from '../protocols/game/MsgPlayerMove';

// 服务协议定义
export interface ServiceType {
    // API接口
    api: {
        "user/Login": {
            req: ReqLogin,
            res: ResLogin
        },
        "game/JoinRoom": {
            req: ReqJoinRoom,
            res: ResJoinRoom
        }
    },
    // 消息接口
    msg: {
        "game/GameState": MsgGameState,
        "game/PlayerMove": MsgPlayerMove
    }
}

// 导出服务协议
export const serviceProto: ServiceProto<ServiceType> = {
    version: 1,
    services: {
        // API
        "user/Login": {
            type: "api",
            conf: {}
        },
        "game/JoinRoom": {
            type: "api",
            conf: {}
        },
        // Messages
        "game/GameState": {
            type: "msg",
            conf: {}
        },
        "game/PlayerMove": {
            type: "msg",
            conf: {}
        }
    }
}; 